package com.ruoyi.system.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.OaInvoiceApplicationMapper;
import com.ruoyi.system.domain.OaInvoiceApplication;
import com.ruoyi.system.service.IOaInvoiceApplicationService;

/**
 * 发票开具申请单Service业务层处理
 *
 * @author ruoyi
 * @date 2025-03-14
 */
@Service
public class OaInvoiceApplicationServiceImpl implements IOaInvoiceApplicationService
{
    @Autowired
    private OaInvoiceApplicationMapper oaInvoiceApplicationMapper;

    /**
     * 查询发票开具申请单
     *
     * @param id 发票开具申请单主键
     * @return 发票开具申请单
     */
    @Override
    public OaInvoiceApplication selectOaInvoiceApplicationById(Long id)
    {
        return oaInvoiceApplicationMapper.selectOaInvoiceApplicationById(id);
    }

    /**
     * 查询发票开具申请单列表
     *
     * @param oaInvoiceApplication 发票开具申请单
     * @return 发票开具申请单
     */
    @Override
    public List<OaInvoiceApplication> selectOaInvoiceApplicationList(OaInvoiceApplication oaInvoiceApplication)
    {
        return oaInvoiceApplicationMapper.selectOaInvoiceApplicationList(oaInvoiceApplication);
    }

    /**
     * 新增发票开具申请单
     *
     * @param oaInvoiceApplication 发票开具申请单
     * @return 结果
     */
    @Override
    public int insertOaInvoiceApplication(OaInvoiceApplication oaInvoiceApplication)
    {
        oaInvoiceApplication.setIsApproved(0);

        return oaInvoiceApplicationMapper.insertOaInvoiceApplication(oaInvoiceApplication);
    }

    /**
     * 修改发票开具申请单
     *
     * @param oaInvoiceApplication 发票开具申请单
     * @return 结果
     */
    @Override
    public int updateOaInvoiceApplication(OaInvoiceApplication oaInvoiceApplication)
    {
        return oaInvoiceApplicationMapper.updateOaInvoiceApplication(oaInvoiceApplication);
    }

    /**
     * 批量删除发票开具申请单
     *
     * @param ids 需要删除的发票开具申请单主键
     * @return 结果
     */
    @Override
    public int deleteOaInvoiceApplicationByIds(Long[] ids)
    {
        return oaInvoiceApplicationMapper.deleteOaInvoiceApplicationByIds(ids);
    }

    /**
     * 删除发票开具申请单信息
     *
     * @param id 发票开具申请单主键
     * @return 结果
     */
    @Override
    public int deleteOaInvoiceApplicationById(Long id)
    {
        return oaInvoiceApplicationMapper.deleteOaInvoiceApplicationById(id);
    }

}
